package com.hz.qs.controller;

import com.hz.qs.model.YiCheckGuide;
import com.hz.qs.service.CustomerService;
import com.hz.qs.utils.RestResult;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 健管师个人中心controller
 * @author yejy
 * @date 2020/10/29 16:06
 */
@Slf4j
@RestController
@RequestMapping("personCenter/")
public class PersonCenterController {

    @Autowired
    private CustomerService customerService;

    @ApiOperation("08 健管师客户列表")
    @GetMapping("getAllCustomerData")
    public RestResult getAllCustomerData(@RequestParam String jgsId,@RequestParam String currentDate,String state){
        return customerService.getAllCustomerData(jgsId,currentDate,state);
    }

    @ApiOperation("10 体检导检单展示")
    @GetMapping("getCheckGuideData")
    public RestResult getCheckGuideData(@RequestParam String checkId,@RequestParam String customerId,@RequestParam String currentDate){
        return customerService.getCheckGuideData(checkId,currentDate,customerId);
    }

    @ApiOperation("11 编辑体检导检单")
    @PostMapping("editCheckGuide")
    public RestResult editCheckGuide(@RequestBody YiCheckGuide guide){
        try {
            Integer integer =  customerService.editCheckGuide(guide);
            return RestResult.successResult(integer);
        }catch (Exception e){
            log.error(e.getMessage());
            return RestResult.failResult("客户详情编辑失败！",500);
        }
    }

}
